package com.yiren.manager.service.impl.assets;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yiren.core.exception.MyException;
import com.yiren.core.service.GenericServiceImpl;
import com.yiren.core.utils.Favorites;
import com.yiren.entity.YrRoomAsset;
import com.yiren.entity.YrRoomAssetDamaged;
import com.yiren.manager.repository.assets.YrRoomAssetDamagedRepository;
import com.yiren.manager.repository.assets.YrRoomAssetRepository;
import com.yiren.manager.service.iface.assets.YrRoomAssetDamagedService;

@Service
public class YrRoomAssetDamagedServiceImpl extends GenericServiceImpl<YrRoomAssetDamaged, String> implements YrRoomAssetDamagedService{

	@Autowired
	private YrRoomAssetRepository roomAssetRepositoty;
	
	@Autowired
	public YrRoomAssetDamagedServiceImpl(YrRoomAssetDamagedRepository repository) {
		super(repository);
	}

	@Transactional
	public void addByFavorites(Favorites entitys) throws MyException {
		YrRoomAssetDamaged roomAssetDamaged = entitys.getFavorite(YrRoomAssetDamaged.class);
		YrRoomAsset roomAsset = entitys.getFavorite(YrRoomAsset.class);
		
		this.repository.save(roomAssetDamaged);
		roomAssetRepositoty.save(roomAsset);
		
	}

	public void modifyByFavorites(Favorites entitys) throws MyException {
		// TODO Auto-generated method stub
		
	}

}
